import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path:'/',
    component: ()=> import(`@/views/home/Home.vue`)
  },
  {
    path:'/oauth/login/qq',
    component: ()=> import(`@/views/oauth/QQLogin.vue`)
  },
  {
    path:'/home',
    component: ()=> import(`@/views/home/Home.vue`)
  },
  {
    path:'/post/:articleId',
    component: ()=> import(`@/views/post/Post.vue`)
  },
  {
    path: '/:pathMatch(.*)*',
    name: 'notFound',
    redirect:'/home'
  }
]

const router = new VueRouter({
  mode: 'history',
  routes,
  scrollBehavior (to, from, savedPosition) {
    return {x:0,y:0}
  }
})

export default router
